package il.ac.technion.cs236700.utils.CSV;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;

/**
 * Util to read a csv file and manipulate it into string/strings collection
 * 
 * @author Regev Azriel
 *
 */
public class CSVReader {

	private FileReader fr;
	
	public CSVReader(String fileName) throws IOException{
		fr = new FileReader(fileName);
	}
	
	@Override
	public String toString() {
		BufferedReader br = new BufferedReader(fr);
		String $,$$ = "";
		try {
			while(($=br.readLine())!=null)
				$$.concat($);
		} catch (IOException e) {
			e.printStackTrace();
			return "error during read\n";
		}
		return $$;
	}
	
	public String[] toStringArray(){
		String $ = this.toString();
		return $.split("\n");
	}	
}
